package com.zyc.sanfang;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zyc.util.ConfigPropertiesUtil;

public class ValidateCodeService {
	static String userName;
	static String password;
	static String softKey;
	static {
		ValidateCodeService.userName = ConfigPropertiesUtil.getProperties("userName");
		ValidateCodeService.password = ConfigPropertiesUtil.getProperties("password");
		ValidateCodeService.softKey = ConfigPropertiesUtil.getProperties("softKey");
	}
	public static String getSixLengthByPath(String validataPicPath) {
		String postBackString  =  ChaoJiYing.PostPic(userName, password, softKey, "1006", "6", validataPicPath);;
		JSONObject jsonObject =  JSON.parseObject(postBackString);
		String validataCode = jsonObject.getString("pic_str");
		return validataCode;
	}
	
	public static JSONObject getSixLengthByPathAsJSONObject(String validataPicPath) {
		String postBackString  =  ChaoJiYing.PostPic(userName, password, softKey, "1006", "6", validataPicPath);;
		JSONObject jsonObject =  JSON.parseObject(postBackString);
		return jsonObject;
	}
	
	public static String getFourLengthByPath(String validataPicPath) {
		String postBackString  =  ChaoJiYing.PostPic(userName, password, softKey, "1004", "4", validataPicPath);;
		JSONObject jsonObject =  JSON.parseObject(postBackString);
		String validataCode = jsonObject.getString("pic_str");
		return validataCode;
	}
	public static JSONObject getFourLengthByPathAsJSONObject(String validataPicPath) {
		String postBackString  =  ChaoJiYing.PostPic(userName, password, softKey, "1004", "4", validataPicPath);;
		JSONObject jsonObject =  JSON.parseObject(postBackString);
		return jsonObject;
	}
	
	public static JSONObject getErrorResult(String picId) {
		String postBackString  = ChaoJiYing.ReportError(userName, password, softKey, picId);
		JSONObject jsonObject =  JSON.parseObject(postBackString);
		return jsonObject;
	}
}
